<!DOCTYPE html>
<html>
<ui:composition 
	xmlns="http://www.w3.org/1999/xhtml" 
	xmlns:ui="http://java.sun.com/jsf/facelets" 
	xmlns:s="http://jboss.org/schema/seam/taglib" 
	xmlns:h="http://java.sun.com/jsf/html" 
	xmlns:f="http://java.sun.com/jsf/core" 
	xmlns:p="http://primefaces.org/ui" 
	template="/templates/main.xhtml">

	<ui:define name="content">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div id="widget_title" class="widget-title" onclick="$('#formz').collapse('toggle')">
						<span class="icon"> <i class="icon icon-pencil"></i>
						</span>
						<h5>Cadastrar usuário</h5>
					</div>

					<h:form id="formz" styleClass="form-horizontal">

						<div class="control-group">
							<label class="control-label">Nome :</label>
							<div class="controls">
								<p:inputText id="nome" required="true" value="#{statusBean.statusForm.nome}" />
							</div>
						</div>

						<div class="form-actions">
							<p:commandButton value="Salvar" update=":formz,:table_form" styleClass="btn btn-inverse" actionListener="#{statusBean.save}" onclick="msgs.show();" />
							<p:commandButton value="Deletar" update=":formz,:table_form" styleClass="btn btn-inverse" rendered="#{statusBean.showDeleteButton}" actionListener="#{statusBean.delete}" onclick="msgs.show();" />
							<p:commandButton value="Cancelar" update=":formz" styleClass="btn btn-inverse" actionListener="#{statusBean.cancel}" />
						</div>

					</h:form>

				</div>

			</div>
		</div>


		<div class="row-fluid">

			<div class="span12">

				<h:form id="table_form">

					<div class="widget-box">

						<div class="widget-title">
							<span class="icon"> <i class="icon-th"></i></span>
							<h5>Lista de status</h5>
						</div>

						<div class="widget-content">

							<p:dataTable id="table" var="status" value="#{statusBean.dataModel}" tableStyleClass="table table-bordered table-striped" paginator="true" paginatorPosition="bottom" rows="10" selection="#{statusBean.statusForm}" selectionMode="single" emptyMessage="Nenhuma status cadastrado">
								<p:ajax event="rowSelect" listener="#{statusBean.onRowSelect}" update=":formz" oncomplete="onSelectItemOpenForm('formz');" />
								<p:column headerText="Nome">
									<h:outputText value="#{status.nome}" />
								</p:column>
							</p:dataTable>

						</div>
					</div>

				</h:form>

			</div>

		</div>

	</ui:define>
</ui:composition>
</html>